import React from 'react';
import { Button, Icon } from 'antd';
import { ObjectType } from '@/pages/riskControl/utils';
import style from './OperationResultPage.less';

/**
 * 操作结果页面
 * @param isSuccess boolean 成功/失败
 * @param message string 操作以后的信息
 * @param goBack function 返回按钮的点击动作
 */
export default function OperationResultPage({ isSuccess, message, goBack }: ObjectType) {
  return (
    <div className={style.ExamineResultPageStyle}>
      <div className={style.container}>
        {isSuccess ? (
          <Icon
            type="check-circle"
            className={style.success}
            style={{ fontSize: '56px', color: '#52c41b' }}
          />
        ) : (
          <Icon
            type="close-circle"
            className={style.fail}
            theme="filled"
            style={{ fontSize: '56px', color: '#f5222d' }}
          />
        )}
        <h3 className={style.title}>{isSuccess ? '审核完成' : '操作失败'}</h3>
        <p>{message}</p>
        <Button className={style.backButton} type="primary" onClick={() => goBack()}>
          返回
        </Button>
      </div>
    </div>
  );
}
